package April.april29;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/*
反射获取有参数的成员方法并执行
public static void seelp(String,int,double){}
 */
public class ReflectDemo_7 {
    public static void main(String[] args) throws IllegalAccessException, InstantiationException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException {
        Class c = Class.forName("April.april28.Person");
        Object obj = c.newInstance();
//        调用Class类的方法invoke运行seelp方法
        Method method = c.getMethod("seelp", String.class, int.class, double.class);
//        调用Method类方法invoke运行seelp方法
        method.invoke(obj,"休眠",100,888.99);
    }
}
